package com.example.transaction.sys.mapper;

import com.example.transaction.sys.entity.Order;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.data.repository.query.Param;

import java.time.LocalDateTime;
import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author zh
 * @since 2023-06-20
 */
@Mapper
public interface OrderMapper extends BaseMapper<Order> {
    @Select("SELECT * FROM orders WHERE expireTime < #{now} AND orderStatus = #{status}")
    List<Order> findExpiredOrders(@Param("now") LocalDateTime now, @Param("status") String status);

}
